﻿# 智能客服系统一键启动脚本
Write-Host "正在启动智能客服系统..." -ForegroundColor Green

# 停止现有进程
Get-Process | Where-Object {.ProcessName -like "*SmartCustomerService*"} | Stop-Process -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2

# 启动应用
Set-Location "SmartCustomerService.Web"
Start-Process -FilePath "dotnet" -ArgumentList "run" -WindowStyle Hidden

# 等待启动
Write-Host "等待应用启动..." -ForegroundColor Yellow
Start-Sleep -Seconds 10

# 检查状态并打开浏览器
 = netstat -an | findstr :5001
if () {
    Write-Host "应用启动成功！正在打开浏览器..." -ForegroundColor Green
    Start-Process "https://localhost:5001/swagger"
    Start-Process "http://localhost:5000/swagger"
    Write-Host "Swagger API 文档已打开！" -ForegroundColor Cyan
} else {
    Write-Host "应用启动失败，请检查错误信息" -ForegroundColor Red
}
